package com.example.myretrofit2.presenter;

import com.example.myretrofit2.Car;
import com.example.myretrofit2.httpMesholds.HttpMesholds;

import java.util.List;

import rx.Observable;
import rx.Subscriber;

public class CarPresenter extends HttpMesholds {
    public static void queryCar(Subscriber<List<Car>> s){
            Observable observable = carService.queryCar().map(new ResultFunc1<List<Car>>());
        toSub(observable,s);
    }
    public static void insertCar(Subscriber<Boolean> s,Car car){
        Observable observable = carService.insertCar(car).map(new ResultFunc1<Boolean>());
        toSub(observable,s);
    }
    public static void updateCar(Subscriber<Boolean> s,Car car){
        Observable observable = carService.updateCar(car).map(new ResultFunc1<Boolean>());
        toSub(observable,s);
    }
    public static void delCar(Subscriber<Boolean> s,int id){
        Observable observable = carService.delCar(id).map(new ResultFunc1<Boolean>());
        toSub(observable,s);
    }
}
